package com.example.xyh.Controller;

import com.example.xyh.service.ShopItemService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping
@Tag(name = "ShopItem", description = "ShopItemController")
public class ShopItemController {
    @Resource
    ShopItemService shopItemService;

    @Autowired
    public ShopItemController(ShopItemService shopItemService) {
        this.shopItemService = shopItemService;
    }


    @PostMapping("/ShopItemList")
    public List<com.example.xyh.dto.ShopItemDto> shopItemList(Integer shop_id) {
        return shopItemService.shopItemList(shop_id);
    }


    @PostMapping("/AddShopItem")
    public com.example.xyh.dto.ShopItemDto addShopItem(Integer shop_id, Integer item_id) {
        return shopItemService.addShopItem(shop_id, item_id);
    }


    @PostMapping("/DeleteShopItem")
    public boolean deleteShopItem(Integer shop_id, Integer item_id) {
        Integer number = shopItemService.deleteShopItem(shop_id, item_id);
        return true;
    }



}
